﻿using System;
using System.IO;
using System.Text;

namespace Studio
{
	// Token: 0x020004AE RID: 1198
	public class WorkInfo
	{
		// Token: 0x06001E05 RID: 7685 RVA: 0x000BE760 File Offset: 0x000BC960
		public void Init()
		{
			for (int i = 0; i < 6; i++)
			{
				this.visibleFlags[i] = true;
			}
			this.visibleCenter = true;
			this.visibleAxis = true;
			this.useAlt = false;
		}

		// Token: 0x06001E06 RID: 7686 RVA: 0x000BE7A0 File Offset: 0x000BC9A0
		public void Save()
		{
			string path = UserData.Create("studio") + "work.dat";
			using (FileStream fileStream = new FileStream(path, FileMode.Create, FileAccess.ReadWrite))
			{
				using (BinaryWriter binaryWriter = new BinaryWriter(fileStream, Encoding.UTF8))
				{
					try
					{
						binaryWriter.Write(this.version.ToString());
						for (int i = 0; i < 6; i++)
						{
							binaryWriter.Write(this.visibleFlags[i]);
						}
						binaryWriter.Write(this.visibleCenter);
						binaryWriter.Write(this.visibleAxis);
						binaryWriter.Write(this.useAlt);
					}
					catch (Exception)
					{
						File.Delete(path);
					}
				}
			}
		}

		// Token: 0x06001E07 RID: 7687 RVA: 0x000BE88C File Offset: 0x000BCA8C
		public void Load()
		{
			string path = UserData.Create("studio") + "work.dat";
			if (!File.Exists(path))
			{
				this.Init();
				return;
			}
			using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
			{
				using (BinaryReader binaryReader = new BinaryReader(fileStream, Encoding.UTF8))
				{
					try
					{
						binaryReader.ReadString();
						for (int i = 0; i < 6; i++)
						{
							this.visibleFlags[i] = binaryReader.ReadBoolean();
						}
						this.visibleCenter = binaryReader.ReadBoolean();
						this.visibleAxis = binaryReader.ReadBoolean();
						this.useAlt = binaryReader.ReadBoolean();
					}
					catch (Exception)
					{
						File.Delete(path);
						this.Init();
					}
				}
			}
		}

		// Token: 0x04002080 RID: 8320
		private const string userPath = "studio";

		// Token: 0x04002081 RID: 8321
		private const string fileName = "work.dat";

		// Token: 0x04002082 RID: 8322
		private readonly Version version = new Version(0, 1, 0);

		// Token: 0x04002083 RID: 8323
		public bool[] visibleFlags = new bool[]
		{
			true,
			true,
			true,
			true,
			true,
			true
		};

		// Token: 0x04002084 RID: 8324
		public bool visibleCenter = true;

		// Token: 0x04002085 RID: 8325
		public bool visibleAxis = true;

		// Token: 0x04002086 RID: 8326
		public bool useAlt;
	}
}
